package com.pro.common.api.user.task.model.db;

import com.pro.common.api.model.BaseUserIdModel;
import com.pro.common.api.model.auth.IUserRecordClass;
import com.pro.framework.javatodb.annotation.JTDField;
import com.pro.framework.javatodb.annotation.JTDTable;
import com.pro.framework.javatodb.constant.JTDConst;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Data
@Schema(description = "用户任务每个步骤的每次调用")
@JTDTable(entityId = 20001, sequences = {
        "KEY `idx_taskId` (`task_id`)",
        "KEY `idx_stepId` (`step_id`)",
})
public class UserTaskStepCall extends BaseUserIdModel implements IUserRecordClass {

    @Schema(description = "任务ID")
    private Long taskId;

    @Schema(description = "步骤ID")
    private Long stepId;

    @Schema(description = "第几步")
    private Integer stepOrder;

    @Schema(description = "请求URL")
    private String requestUrl;

    @Schema(description = "请求方法 GET/POST等")
    private String requestMethod;

    @Schema(description = "请求头(JSON)")
    private String requestHeaders;

    @Schema(description = "请求体(JSON)")
    @JTDField(type = JTDConst.EnumFieldType.text)
    private String requestBody;

    @Schema(description = "响应URL")// 异步时
    private String responseUrl;

    @Schema(description = "响应状态码")
    private Integer responseCode;

    @Schema(description = "响应头(JSON)")
    private String responseHeaders;

    @Schema(description = "响应体(JSON)")
    @JTDField(type = JTDConst.EnumFieldType.text)
    private String responseBody;

    @Schema(description = "调用耗时(毫秒)")
    private Long durationMs;

    @Schema(description = "是否成功 1=成功 0=失败")
    private Boolean success;

}
